home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / Include / ds5000.md / timerTick.h < prev    next >
C/C++ Source or Header  |  1990-11-07  |  3KB  |  102 lines

  1. /*
  2.  * timerTick.h --
  3.  *
  4.  *      Declarations for the Sun3 machine dependent clock timer.
  5.  *
  6.  * Copyright (C) 1989 Digital Equipment Corporation.
  7.  * Permission to use, copy, modify, and distribute this software and
  8.  * its documentation for any purpose and without fee is hereby granted,
  9.  * provided that the above copyright notice appears in all copies.  
  10.  * Digital Equipment Corporation makes no representations about the
  11.  * suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * rcsid: $Header: /sprite/src/kernel/timer/ds3100.md/RCS/timerTick.h,v 9.1 90/09/06 18:22:42 jhh Exp $ SPRITE (DECWRL) 
  15.  */
  16.  
  17. #ifndef _TIMERTICK
  18. #define _TIMERTICK
  19.  
  20. #include "spriteTime.h"
  21.  
  22. /*
  23.  * Timer_Ticks is just a Time value.
  24.  */
  25. typedef Time Timer_Ticks;
  26.  
  27. /*
  28.  * Definitions for useful intervals and clock values. 
  29.  * See timer.h for more details.
  30.  */
  31. extern unsigned int     timer_IntZeroSeconds; 
  32. extern unsigned int     timer_IntOneMillisecond;   
  33. extern unsigned int     timer_IntOneSecond;
  34. extern unsigned int     timer_IntOneMinute;
  35. extern unsigned int     timer_IntOneHour; 
  36. extern Timer_Ticks    timer_TicksZeroSeconds;
  37. extern Time         timer_MaxIntervalTime; 
  38.  
  39. /*
  40.  * Because we speak in the same units as type Time, we can
  41.  * use the Time_ modules routines to Add and Subtract
  42.  */
  43.  
  44. #ifdef lint
  45. #define Timer_AddTicks(a,b,c)      Time_Add((* ((Time *) &a)),\
  46.                         (* ((Time *) &b)), \
  47.                         (Time *) c)
  48. #define Timer_SubtractTicks(a,b,c) Time_Subtract((* ((Time *) &a)), \
  49.                          (* ((Time *) &b)), \
  50.                          (Time *) c)
  51. #else /* lint */
  52. #define Timer_AddTicks(a,b,c)      Time_Add(a,b,c)
  53. #define Timer_SubtractTicks(a,b,c) Time_Subtract(a,b,c)
  54. #endif /* lint */
  55.  
  56. /*
  57.  * Conversion to Ticks to Time and Time to Ticks is fast too.
  58.  */
  59. #define Timer_TicksToTime(a,b)        *(b) = a;
  60. #define Timer_TimeToTicks(a,b)        *(b) = a;
  61.  
  62. extern void Timer_AddIntervalToTicks _ARGS_((Timer_Ticks absolute, 
  63.         unsigned int interval, Timer_Ticks *resultPtr));
  64. extern void Timer_GetCurrentTicks _ARGS_((Timer_Ticks *ticksPtr));
  65.  
  66.  
  67. /*
  68.  *----------------------------------------------------------------------
  69.  *
  70.  * Tick Comparisons --
  71.  *
  72.  *    Timer_TickLT:    tick1  <   tick2
  73.  *    Timer_TickLE:    tick1  <=  tick2
  74.  *    Timer_TickEQ:    tick1  ==  tick2
  75.  *    Timer_TickGE:    tick1  >=  tick2
  76.  *    Timer_TickGT:    tick1  >   tick2
  77.  *
  78.  * Results:
  79.  *     TRUE    - the relation holds for the 2 values.
  80.  *     FALSE    - the relation does not hold.
  81.  *
  82.  * Side effects:
  83.  *     None.
  84.  *
  85.  *----------------------------------------------------------------------
  86.  */
  87. #ifdef lint
  88. #define Timer_TickLT(a,b)    Time_LT((* ((Time *) &a)), (* ((Time *) &b)))
  89. #define Timer_TickLE(a,b)    Time_LE((* ((Time *) &a)), (* ((Time *) &b)))
  90. #define Timer_TickEQ(a,b)    Time_EQ((* ((Time *) &a)), (* ((Time *) &b)))
  91. #define Timer_TickGE(a,b)    Time_GE((* ((Time *) &a)), (* ((Time *) &b)))
  92. #define Timer_TickGT(a,b)    Time_GT((* ((Time *) &a)), (* ((Time *) &b)))
  93. #else /* lint */
  94. #define Timer_TickLT(a,b)    Time_LT(a,b)
  95. #define Timer_TickLE(a,b)    Time_LE(a,b)
  96. #define Timer_TickEQ(a,b)    Time_EQ(a,b)
  97. #define Timer_TickGE(a,b)    Time_GE(a,b)
  98. #define Timer_TickGT(a,b)    Time_GT(a,b)
  99. #endif /* lint */
  100.  
  101. #endif /* _TIMERTICK */
  102.